<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**待办事务，当前是邮件
 * Class CreateTaskTable
 */
class CreateTaskTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('task', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_general_ci';
            $table->increments('id');
            $table->tinyInteger('type')->default(1)->comment('事物类型，默认为1，代表邮件待发');
            $table->tinyInteger('sendtype')->default(1)->comment('事物类型，默认为1，代表审核通过邮件待发，2代表确认修复邮件代发3即将过期4已过期5邮件流终结');
            $table->integer('appid')->comment('应用id')->nullable();
            $table->string('appname',255)->comment('应用名称')->nullable();
            $table->integer('vulsid')->comment('漏洞id');
            $table->string('title',255)->comment('漏洞标题');
            $table->integer('user_id')->comment('提交者id')->nullable();
            $table->string('useremail',255)->comment('收件人邮箱');
            $table->string('user',255)->comment('收件人')->nullable();
            $table->integer('level_id')->comment('漏洞级别id')->nullable();
            $table->string('level_name',255)->comment('漏洞等级名称')->nullable();
            $table->string('deadline',255)->comment('漏洞修复时限')->nullable();
            $table->string('time',255)->comment('漏洞修复时间')->nullable();
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('updated_at')->nullable();
            $table->timestamp('deleted_at')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropIfExists('task');
    }
}
